/*  1:   */package com.java.diagnostics.visualizer.recommender.occupancy;
/*  2:   */
/*  3:   */import com.java.diagnostics.visualizer.data.AggregateData;
/*  4:   */import com.java.diagnostics.visualizer.data.DataPoint;
/*  5:   */import com.java.diagnostics.visualizer.data.TupleData;
/*  6:   */import com.java.diagnostics.visualizer.gc.recommender.RecommendationPreferenceHelper;
/*  7:   */import com.java.diagnostics.visualizer.parser.vgc.constants.VGCAxes;
/*  8:   */import com.java.diagnostics.visualizer.parser.vgc.constants.VGCGCScopes;
/*  9:   */import com.java.diagnostics.visualizer.recommender.Recommendation;
/* 10:   */import com.java.diagnostics.visualizer.recommender.RecommendationBase;
/* 11:   */import com.java.diagnostics.visualizer.recommender.util.Messages;
/* 12:   */
/* 24:   */public class TenuredOccupancyRecommendation
/* 25:   */  extends RecommendationBase
/* 26:   */  implements Recommendation
/* 27:   */{
/* 28:   */  public void recommend(AggregateData data)
/* 29:   */  {
/* 30:30 */    Object gcMode = getGCMode(data);
/* 31:31 */    if ("gencon".equals(gcMode)) {
/* 32:32 */      TupleData occupancy = data
/* 33:33 */        .getTupleData("VGCLabels.live.tenured.heap.after.gc");
/* 34:34 */      TupleData scopes = data.getTupleData("VGCLabels.gc.scopes");
/* 35:   */      
/* 42:42 */      if ((occupancy != null) && (scopes != null)) {
/* 43:43 */        double runningTotal = 0.0D;
/* 44:44 */        DataPoint[] tenuredGC = occupancy.getDataPoints();
/* 45:45 */        int count = 0;
/* 46:   */        
/* 48:48 */        for (DataPoint gc : tenuredGC) {
/* 49:49 */          DataPoint scopePoint = scopes.getDataPoint(
/* 50:50 */            gc.getSequenceUID());
/* 51:51 */          if ((int)scopePoint.getRawY() == VGCGCScopes.GLOBAL_INT)
/* 52:   */          {
/* 53:53 */            runningTotal = runningTotal + gc.getY(VGCAxes.PERCENT_SIGN);
/* 54:54 */            count++;
/* 55:   */          }
/* 56:   */        }
/* 57:57 */        int meanOccupancy = (int)Math.round(runningTotal / count);
/* 58:   */        
/* 63:63 */        if (meanOccupancy > this.helper.getHighOccupancyThreshold())
/* 64:   */        {
/* 65:65 */          String string = 
/* 66:66 */            Messages.getString(
/* 67:67 */            "high.tenured.area.occupancy.message", new Object[] { Integer.valueOf(meanOccupancy) });
/* 68:68 */          addWarning(data, string);
/* 69:   */        }
/* 70:   */      }
/* 71:   */    }
/* 72:   */  }
/* 73:   */}


